///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                            //
//                                                         WNProject                                                          //
//                                                                                                                            //
//            This file is distributed under the BSD 2-Clause open source license. See License.txt for details.               //
//                                                                                                                            //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef __WN_READ_TEXT_FILE_BUFFER__
#define __WN_READ_TEXT_FILE_BUFFER__

#include "WNFileIO/inc/WNFileBuffer.h"
#include "WNFileIO/inc/WNFile.h"

namespace WNFileIO {
    class WNReadTextFileBuffer : public WNFileBuffer {
    public:
        WNReadTextFileBuffer(WNFileBufferType _type, WN_SIZE_T _initialBufferSize = 1024);
        virtual ~WNReadTextFileBuffer();
        virtual WN_BOOL Serialize(WN_UINT32 _flags, const WNContainers::WNSerializerBase& _serializer);
        virtual WNFile::WNFileError SetFile(const WN_CHAR* fileName);
        virtual WN_CHAR* ReserveBytes(WN_SIZE_T _numBytes, WN_SIZE_T& _returnedBytes);
        virtual WNContainers::WNDataBufferType GetType();

    private:
        WN_CHAR* mCurrentBuff;
        WN_CHAR* mSpareBuff;
        WN_SIZE_T mBuffUsage;
        WN_SIZE_T mBuffPlace;
        WN_SIZE_T mBuffSize;
        WN_BOOL mEndFile;
        WNFile mFile;
    };
}

#endif // __WN_READ_TEXT_FILE_BUFFER__
